package com.study.sfd.medicine.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.study.sfd.medicine.entity.SpecificationImgEntity;
import com.study.sfd.medicine.service.SpecificationImgService;
import com.study.common.utils.PageUtils;
import com.study.common.utils.R;



/**
 * specification_img(药品说明书图片)
 *
 * @author 王个球
 * @email wangdajunzy@163.com
 * @date 2021-11-12 13:37:43
 */
@RestController
@RequestMapping("medicine/specificationimg")
public class SpecificationImgController {
    @Autowired
    private SpecificationImgService specificationImgService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    // @RequiresPermissions("medicine:specificationimg:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = specificationImgService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    // @RequiresPermissions("medicine:specificationimg:info")
    public R info(@PathVariable("id") Integer id){
		SpecificationImgEntity specificationImg = specificationImgService.getById(id);

        return R.ok().put("specificationImg", specificationImg);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    // @RequiresPermissions("medicine:specificationimg:save")
    public R save(@RequestBody SpecificationImgEntity specificationImg){
		specificationImgService.save(specificationImg);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    // @RequiresPermissions("medicine:specificationimg:update")
    public R update(@RequestBody SpecificationImgEntity specificationImg){
		specificationImgService.updateById(specificationImg);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    // @RequiresPermissions("medicine:specificationimg:delete")
    public R delete(@RequestBody Integer[] ids){
		specificationImgService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
